﻿#region zh-CHS 2006 - 2007 DemoSoft 团队 | en 2006 - 2007 DemoSoft Team

//     NOTES
// ---------------
//
// This file is a part of the MMOSE(Massively Multiplayer Online Server Engine) for .NET.
//
//                              2006-2007 DemoSoft Team
//
//
// First Version : by H.Q.Cai - mailto:caihuanqing@hotmail.com

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

#region zh-CHS 包含名字空间 | en Include namespace
using System;
using System.Text;
using System.Collections.Generic;
using Demo.Mmose.Core.Timer;
#endregion

namespace Demo.Mmose.Core.Creature.General
{
    /// <summary>
    /// 
    /// </summary>
    internal class ExpireAggressorsTimer : TimeSlice
    {
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private GeneralMobile m_Mobile;
        #endregion

        #region zh-CHS 构造和初始化和清理 | en Constructors and Initializers and Dispose
        /// <summary>
        /// 
        /// </summary>
        /// <param name="m"></param>
        public ExpireAggressorsTimer( GeneralMobile generalMobile )
            : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 5.0 ) )
        {
            m_Mobile = generalMobile;
            Frequency = TimerFrequency.FiveSeconds;
        }
        #endregion

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 
        /// </summary>
        protected override void OnTick()
        {
            if ( m_Mobile.Deleted || ( m_Mobile.Aggressors.Count <= 0 && m_Mobile.Aggressed.Count <= 0 ) )
                m_Mobile.StopAggrExpire();
            else
                m_Mobile.CheckAggrExpire();
        }
        #endregion
    }
}
#endregion